package main

import (
	"fmt"
)

func main() {
	max := []int{0, 0}
	for i := 2; i < 1000; i++ {
		n := cycle(i)
		if n > max[1] {
			max[0], max[1] = i, n
		}
	}
	fmt.Println(max[0], max[1])
}

func cycle(dividend int) int {
	divisor := make([]int, 1, 30)
	divisor[0] = 1
	for i := 0; ; i++ {
		remainder := divisor[i] * 10 % dividend
		if remainder == 0 {
			return 0
		}
		for j, num := range divisor {
			if num == remainder {
				return i - j + 1
			}
		}
		divisor = append(divisor, remainder)
	}
}
